<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="../../lib/layui/css/layui.css"/>
    <script src="../../lib/layui/layui.js"></script>
    <script src="../../js/xadmin.js"></script>
    <script src="../../js/common.js"></script>
</head>
<body>
<!-- 添加患者病例模板 -->
<form class="layui-form layui-form-pane" action="">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">模板名称</label>
        <div class="layui-input-block">
            <textarea placeholder="必填" class="layui-textarea" name="t_name"></textarea>
        </div>
        <label class="layui-form-label">主述</label>
        <div class="layui-input-block">
            <textarea placeholder="选填" class="layui-textarea" name="p_statement"></textarea>
        </div>
        <label class="layui-form-label">过往病史</label>
        <div class="layui-input-block">
            <textarea placeholder="选填" class="layui-textarea" name="p_past_illness"></textarea>
        </div>
        <label class="layui-form-label">身体检查</label>
        <div class="layui-input-block">
            <textarea placeholder="选填" class="layui-textarea" name="p_examination"></textarea>
        </div>
        <label class="layui-form-label">辅助检查</label>
        <div class="layui-input-block">
            <textarea placeholder="选填" class="layui-textarea" name="p_auxiliary"></textarea>
        </div>
        <label class="layui-form-label">治疗意见</label>
        <div class="layui-input-block">
            <textarea placeholder="选填" class="layui-textarea" name="p_idea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="add">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
</html>
<script>
    layui.use(['element', 'form'], function () {
        var $ = layui.jquery
            , form = layui.form
            , element = layui.element;

        //监听提交
        form.on('submit(add)', function (data) {
                //发异步，把数据提交给php
                useAjax("/JT90/addTemplateCasehistory",data.field,"JSON","GET",function (map) {
                    if (map.success){
                        layer.alert("增加成功", {
                            icon: 6
                        },function () {
                            //关闭当前frame
                            xadmin.close();
                            // 可以对父窗口进行刷新
                            xadmin.father_reload();
                        });
                    }else{
                        layer.alert("病历模板提交失败")
                    }
                })
                return false;
        });
    })
</script>